package com.example.demo.socket;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;

public class MyClient {

    public static void main(String[] args) throws IOException {
        SocketChannel socketChannel = SocketChannel.open();
        socketChannel.connect(new InetSocketAddress(8000));
        System.out.println("--------------------");
        socketChannel.write(Charset.defaultCharset().encode("hellosuns\n"));
    }
}
